var btn = document.querySelector(".btn");
var nav = document.querySelector("nav ul");
var navLi = document.querySelectorAll("nav ul li");
var item = document.querySelectorAll(".item");
var arr = [item[0].offsetTop,item[1].offsetTop,item[2].offsetTop,item[3].offsetTop,item[4].offsetTop,item[5].offsetTop,item[6].offsetTop];
btn.onclick=function (){
	if(nav.style.height == '224px'){
		nav.style.height = '0'
	}else{
		nav.style.height = '224px'
	}
}
for (var i = 0;i<navLi.length;i++) {
	navLi[i].index = i;
	navLi[i].onclick=function(){
		window.scrollTo({
			top:arr[this.index],
			behavior:'smooth'
		})
		nav.style.height = '0';
	}
}

